{
  "properties" : { },
  "id" : "187a523d53084bab8af0cc4db16cb07e",
  "script" : null,
  "groupId" : "303fd46849014848bc3f6356ba404ce9",
  "name" : "T-001-访问限制页",
  "createTime" : null,
  "updateTime" : 1715259437268,
  "lock" : null,
  "createBy" : null,
  "updateBy" : "管理员",
  "path" : "001",
  "method" : "GET",
  "parameters" : [ ],
  "options" : [ ],
  "requestBody" : "",
  "headers" : [ ],
  "paths" : [ ],
  "responseBody" : null,
  "description" : null,
  "requestBodyDefinition" : null,
  "responseBodyDefinition" : null
}
================================
import org.openqa.selenium.OutputType
import org.openqa.selenium.By
import org.openqa.selenium.WebElement
import org.openqa.selenium.firefox.FirefoxOptions
import org.openqa.selenium.firefox.FirefoxProfile
import org.openqa.selenium.firefox.FirefoxDriver
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.Cookie
import response

// -- 配置
System.setProperty("webdriver.gecko.driver", "D:/data/spider/file/geckodriver.exe");
var options = new FirefoxOptions();

// -- 启动
FirefoxDriver driver = new FirefoxDriver(options);

// -- 获取
var webImg;
var pageSource;
try {
    // -- 访问
    driver.get("http://hnjtzaxh.com");
        // -- 访问安全限制页面
        //driver.get("http://admin:123456@127.0.0.1:18082/magic/index.html");
        // -- 访问会话限制页面  通过设置 Cookie，重新访问页面
        // driver.manage().addCookie(new Cookie("token", "UU85WGtPdnNMTkxUeTEvS3dXV1czZz09"));
        // driver.navigate().refresh();
    
    // -- 动作
    weAct = new Actions(driver);
        // -- 暂缓 2 秒
        weAct.pause(2*1000);
    // -- 动作 结束
    weAct.perform();

    // -- 取元素
    WebElement we = driver.findElement(By.xpath("//html/body/div[2]"));
        // -- 截图元素
        webImg = we.getScreenshotAs(OutputType.BYTES);
} finally {
    // -- 结束
    driver.close();
}

return response.image(webImg,'image/png');